package network;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class TcpDicServer extends TcpEchoServer {
    Map<String, String> map = new HashMap<>();

    public TcpDicServer(int port) throws IOException {
        super(port);
        map.put("cat","小猫");
        map.put("dog","小狗");
    }

    @Override
    public String process(String request) {
        return map.getOrDefault(request, "抱歉！暂时未收录此词！");
    }

    public static void main(String[] args) throws IOException {
        TcpDicServer tcpDicServer = new TcpDicServer(8080);
        tcpDicServer.start();
    }
}
